package com.cyanite.playlv2api.parsers.json;

import com.cyanite.playlv2api.types.Credentials;

import org.json.JSONException;
import org.json.JSONObject;

public class CredentialsParser extends AbstractParser<Credentials> {
    
    @Override
    public Credentials parse(JSONObject json) throws JSONException {
        Credentials obj = new Credentials();
        if (json.has("oauth_token")) {
            obj.setOauthToken(json.getString("oauth_token"));
        } 
        if (json.has("oauth_token_secret")) {
            obj.setOauthTokenSecret(json.getString("oauth_token_secret"));
        } 
        
        return obj;
    }
}